<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Response
 *
 * @author thuongnh
 */
class Response {

    var $data="";
    
    public function __construct() {
        session_start();
        session_regenerate_id(true);
    }

    public function setCookie($key, $value, $expire=31536000){
        setcookie($key, $value, time()+$expire);
    }
    
    public function deleteCookie($key){
        setcookie($key, "", time()-3600);
    }
    
    public function setSession($key, $value){
        $_SESSION[$key] = $value;
    }
    
    public function deleteSession($key){
        unset($_SESSION[$key]);
    }
    
    public function redirect($url){
        header("Location: $url");
    }

    public function write($data) {
        $this->data = $this->data . $data;
    }

    public function __toString() {
        return $this->data;
    }

}

?>
